import React from 'react'
import {Card, Col, Form, Input, Row} from 'antd'
import 'whatwg-fetch'
import API from '../../axios/api'
import {UserType} from "../../utils/system-data";
require('es6-promise').polyfill();

export default class MainRudder extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            mainRudder: {},
        }
    }

    // 获取数据
    fetchData =  async () => {
        await API.fetchMainRudder().then((res) => {
            if(res.Code === 200) {
                this.setState({
                    mainRudder: res.Data
                });
            }
            this.setState({
                loading: false
            });
        })
    }

    componentDidMount() {
        this.fetchData()
    }

    render(){
        const formItemLayout = {
            labelCol: { span: 2 },
            wrapperCol: { span: 8 },
        };
        return (
            <Row gutter={24}>
                <Col span={24}>
                    <Card bordered={false} className='card-item'>
                        <Form layout="horizontal">
                            <Form.Item label="总舵名称" {...formItemLayout}>
                                <Input value={this.state.mainRudder.MainRudderName}  />
                            </Form.Item>
                            <Form.Item label="总舵头像" {...formItemLayout}>
                                <img width="50" height="50" src={this.state.mainRudder.MainRudderUrl}/>
                            </Form.Item>
                            <Form.Item label="总舵描述" {...formItemLayout}>
                                <Input type="textarea" value={this.state.mainRudder.MainRudderDescribe}/>
                            </Form.Item>
                        </Form>
                    </Card>
                </Col>
            </Row>
        )
    }
}
